#include <iostream>
#include <cstdio>

using namespace std;

#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1

const int maxn = 200011;

int w, h, n;

int maxs[maxn << 2];

void PushUp(int rt) {
	maxs[rt] = max(maxs[rt << 1] , maxs[rt << 1 | 1]);
}

void build(int l, int r, int rt) {
	maxs[rt] = w;
	if (l == r) return;
	int m = (l + r) >> 1;
	build(lson);
	build(rson);
}

int query(int len, int l, int r, int rt) {
	if (l == r) {
		maxs[rt] -= len;
		return l;
	}
	int m = (l + r) >> 1;
	int ans;
	if (maxs[rt << 1] >= len) {
		ans = query(len, lson);
	} else {
		ans = query(len, rson);
	}
	PushUp(rt);
	return ans;
}

int main() {

	while(scanf("%d%d%d", &h, &w, &n) != EOF) {
		if (h > n) h = n;
		build(1, h, 1);
		for (int i = 0; i < n; i++) {
			int len;
			scanf("%d", &len);
			if (len > maxs[1]) {
				cout << "-1" << endl;
			} else {
				cout << query(len, 1, h, 1) << endl;
			}
		}
	}
}
